

class register {
    constructor() {
        this.init();
    }
}
$.extend(register.prototype, {
    init: function () {
        $('.res-abtn').on('click', $.proxy(this.getVerification, this));
    },
    getVerification: function () {
        let a = parseInt(Math.random() * 10);
        let b = parseInt(Math.random() * 10);
        let c = parseInt(Math.random() * 10);
        let d = parseInt(Math.random() * 10);
        let verification = '' + a + b + c + d;
        $('#reg_message').val(verification);
        $('#btn2').on('click', $.proxy(this.resgiToPhp, this));
    },
    resgiToPhp: function () {
        let username = $('#reg_tel').val();
        let telactive = $('#reg_message').val();
        let password = $('#reg_password').val();
        let repassword = $('#reg_repassword').val();
        if (password === repassword) {
            $.ajax({
                url: './php/register.php', data: { username: username, telactive: telactive, password: password }, success: function (res) {
                    console.log(res);
                }
            })

        }
        // console.log(username,telactive,password,repassword);

    }
})


export default register;